A lighting device of an electronic device such as a mobile phone is generally activated according to a preset current value. However, this method may not suit all devices.